<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 2. Console</a><br />
<a href="console_drawing.html">&lt; 2.2 Drawing on the root console</a>
</td><td width="60%">
<p align="center">
=====================================<br />
Filling a rectangle with the background color<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
<p class="code"><pre>
C++ : void TCODConsole::rect(int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag = TCOD_BKGND_SET)
C   : void TCOD_console_rect(TCOD_console_t con,int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag)
Py  : console_rect(con,x,  y,  w, h, clear, flag)
</pre></p>
Defines a rectangle inside a console. For each cell in the rectangle :<br />
- set the cell's background color to the console default background color<br />
- if clear is true, set the cell's ASCII code to 32 (space)<br />
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>con</td><td>In the C version, the offscreen console handler or NULL for the root console.</td></tr>
<tr><td>x,y</td><td>Coordinates of rectangle upper-left corner in the console.<br />0 &lt;= x &lt; console width<br />0 &lt;= y &lt; console height</td></tr>
<tr><td>w,h</td><td>Size of the rectangle in the console.<br />x &lt;= x+w &lt; console width<br />y &lt;= y+h &lt; console height</td></tr>
<tr><td>clear</td><td>if true, all characters inside the rectangle are set to ASCII code 32 (space).<br />If false, only the background color is modified</td></tr>
<tr><td>flag</td><td>This flag defines how the cell's background color is modified. See <a href="bkgnd_flag.html">TCOD_bkgnd_flag_t</a>.</td></tr>
</table>

